<?php
session_start();
include('fungsi_admin.php');
if (!empty($_SESSION['user'])){
?>
<html>
	<head>
		<title>BudiNews.com</title>
		<link rel="shortcut icon" href="../admin/css/mos-css/img/quote.png">
		<!-- Pemanggilan gambar favicon-->
		<link rel="stylesheet" type="text/css" href="../admin/css/mos-css/mos-style.css">
		<!--pemanggilan file css-->
	</head>
	<body>
		<div id="header">
			<div class="inHeader">
				<div class="mosAdmin">
					selamat datang di halaman Admin BudiNews.com
					<br/>
					<a href="keluar.php">Keluar</a>
				</div>
				<div class="clear">
				</div>
			</div>
		</div>
		<div id="wrapper">
			<div id="leftBar">
				<ul>
					<li>
						<a href="dashboard.php">Berita</a>
					</li>
					<li>
						<a href="kategori_tampil.php">Kategori</a>
					</li>
					<li>
						<a href="keluar.php">Keluar</a>
					</li>
				</ul>
			</div>
			<div id="rightContent">
				<h3>Halaman Pengaturan Kategori</h3>
				<center>
				<form method="post" action="">
					<table>
						<tbody>
							<tr>
								<td><b>Tambahkan Kategori</b></td>
								<td><input type="text" name="kategori"></td>
								<td><input class="button" type="submit" value="Simpan"></td>
							</tr>
							<tr class="data">
								<th class="data">ID</th>
								<th class="data">Kategori</th>
								<th class="data" width="35px">Aksi</th>
							</tr>
							<?php
							include("../koneksi.php");
							$sql= "SELECT id_kategori, kategori FROM kategori";
							$hasil= mysql_query($sql) or exit("Error query: <b>".$sql."</b>.");
							while($data= mysql_fetch_assoc($hasil)){ 
						?>
							<tr class="data">
							<td align="center" class="data"><?php echo $data['id_kategori']; ?></td>
							<td class="data"><?php echo $data['kategori']; ?></td>
							<td class="data" align="center">
							<a href="kategori_ubah.php?id=<?php echo $data['id_kategori']; ?>" title="Edit kategori <? echo $data['kategori'];?>">
							<img src="../admin/css/mos-css/img/oke.png"/>
							</a>&nbsp;&nbsp;&nbsp;
							<a href="kategori_hapus.php?id=<?php echo $data['id_kategori']; ?>" onClick="return confirm('Apakah Mau Dihapus?');" title="Hapus kategori <? echo $data['kategori'];?>">
							<img src="../admin/css/mos-css/img/hapus.png"/>
							</a>
							</td>
						</tr>
						<?php } ?>
						</tbody>
					</table>
				</form>
				</center>
			</div>
			<div class="clear">
			</div>
			<div id="footer">
				&copy; 2014 Created by |
				<a href="../pwl">BudiNews.com</a>
			</div>
		</div>
	</body>
</html>
<?php
if(!empty($_POST)){
kategori_tambah($_POST['kategori']);
print_r($_POST);
}
}else{
echo "anda tidak berhak";
}
?>